ss = 0
'''
字符串的去重
'''
# (1)字符串拼接及not in
s = 'asdqweasdzxcsadqweazdasdffrfrrdfreee'
new_s = ''
for i in s:
    if i not in new_s:
        new_s += i  # 拼接
print(new_s)

# (2) 索引加not in
new_s2 = ''
for i in range(len(s)):
    if s[i] not in new_s2:
        new_s2 += s[i]
print(new_s2)

# (3) 通过集合去重+列表排序
new_s3 = set(s)  # 定义集合，利用集合元素不重复的特点，自动去重
print(new_s3)
lst = list(new_s3)  # 转换为列表
lst.sort(key=s.index)  # 按照s的索引排序
print(''.join(lst))
